package com.baizhi.cmfzmanager.appcontroller;

import com.baizhi.cmfzmanager.entity.Article;
import com.baizhi.cmfzmanager.entity.ArticleDTO;
import com.baizhi.cmfzmanager.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/shouye")
public class AppArticleController {

    @Autowired
    private ArticleService articleService;

    @GetMapping("getArticle")
    private List<ArticleDTO> getTwoArticle(){
        return articleService.getTwoArticle();
    }

    @GetMapping("/getAllArticle")
    public List<ArticleDTO> getAllArticle(){

        return articleService.getAllArticle();
    }
    //根据大师id获取大师文章；用户关注的大师
    @GetMapping("/getArticleByGuruId/{id}")
    public List<ArticleDTO> getArticleByGuruId(@PathVariable("id") Integer guruId){
        return articleService.getArticleByGuruId(guruId);
    }
}
